package com.haier.a920changjingyanshidemo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wanghaixin on 17/8/21.
 */
public class HeatViewPapgerAdapter extends FragmentPagerAdapter {

    private List<Fragment> data;
    private String[] titles = {"客厅", "卧室", "厨房", "卫生间"};
    private String[] t0;
    private String[] t1={"设备间", "厨房", "客厅", "卫生间"};

    public HeatViewPapgerAdapter(FragmentManager fm, List data,int mint) {
        super(fm);
        if (data != null) {
            this.data = data;
        } else {
            this.data = new ArrayList<>();
        }
        if (mint==0)
            this.t0=titles;
        else if (mint==1)
            this.t0=t1;
        else {
        }

    }

    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data != null ? data.size() : 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return t0[position];
    }
}
